﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example06.aspx.cs" Inherits="Chapter30.Example06" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 30-6 使用 type 属性</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style title="cor styles">
        p {
            background: gray;
            color: white;
            padding: 10px;
            margin: 5px;
            border: thin solid black;
        }
    </style>
</head>
<body>
    <p>
        There are lots of different kinds of fruit - there are you over 500 varieties 
        of banana alone. By the time we add the countless 
        types of apples, oranges, and other well-known fruit, we are 
        faced with thousands of choices.
    </p>
    <p id="block2">
        On of the most interesting aspects of fruit is the variety available in
        each country. I live near London, in an area which is known for
        its apples.
    </p>
    <script>
        var pElems = document.getElementsByTagName("p");
        for (var i = 0; i < pElems.length; i++) {
            pElems[i].onmouseover = handleMouseEvent;
            pElems[i].onmouseout = handleMouseEvent;
        }

        function handleMouseEvent(e) {
            if (e.type == 'mouseover') {
                e.target.style.background = 'white';
                e.target.style.color = 'black';
            } else {
                e.target.style.removeProperty('color');
                e.target.style.removeProperty('background');
            }
        }
    </script>
</body>
</html>
